package org.pangu.client.dubbo;

import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.cluster.Cluster;
import com.alibaba.dubbo.rpc.cluster.Directory;

public class TagClusterWrapper implements Cluster {

    private Cluster cluster;

    public TagClusterWrapper(Cluster cluster) {
        this.cluster = cluster;
    }

    @Override
    public <T> Invoker<T> join(Directory<T> directory) throws RpcException {
        Invoker<T> targetInvoker = cluster.join(directory);

        return new TagInvoker<>(targetInvoker);
    }
}